<script setup lang="ts">
import { computed, onMounted, provide } from "vue";

import useDataStore from "./stores/Data";
import ONewNav from './components/ONewNav.vue';
import { useRoute } from "vue-router";




// 使用 useRoute 获取当前路由信息
const route = useRoute();

// 计算属性，用于决定是否显示导航栏
const showNavbar = computed(() => {
    // 返回 true 时显示导航栏，返回 false 时隐藏导航栏
    return (
        route.path !== '/login' &&
        route.path !== '/register' &&
        route.path !== '/Manage' && // 添加对 Manage 路径的检查
        route.path !== '/exgindex' // 添加对 exgindex 路径的检查
    );
});


const useData = useDataStore()
provide('homeData', useData.theHome)

onMounted(() => {
    if (!localStorage.getItem('home')) {
        useData.getHomeData()
        console.log(11)
    }
    console.log("仓库首页数据", useData.theHome)
    console.log("仓库详情数据", useData.theDetail)
    console.log("仓库我的课程数据", useData.theCollect)
})
</script>

<template>
    <div id="app">
        <ONewNav v-if="showNavbar" />
        <router-view></router-view>
    </div>
</template>

<style scoped></style>
